﻿using System.IO;
using System.Reflection;

namespace SharpDepend.Resources
{
    /// <summary>
    /// Static class that helps to get embedded resources by searching it with a window explorer feeling.
    /// <para>Resources folder is the root when searching.</para>
    /// </summary>
    public static class EmbeddedResources
    {
        public static Stream GetResource(string path)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            string[] resources = assembly.GetManifestResourceNames();

            Stream stream = assembly.GetManifestResourceStream("SharpDepend.Resources." + path.Replace('\\', '.').Replace('/', '.'));
            return stream;
        }

        public static string GetResourceID(string path)
        {
            return "SharpDepend.Resources." + path.Replace('\\', '.').Replace('/', '.');
        }
    }
}
